package ch.zhaw.swp1.model.message.address;

import java.util.List;

import ch.zhaw.swp1.model.status.Status;
import ch.zhaw.swp1.model.status.error.AddressFormatError;

/**
 * Class representing an SMS Address
 * @author Daniel Tiefenauer
 */
public class SMSAddress extends Address {
	
	/**
	 * Default version
	 */
	private static final long serialVersionUID = 1L;
	
	/************************************************************************************/
	/* Constructors
	/*----------------------------------------------------------------------------------*/
	/**
	 * Default constructor
	 */
	public SMSAddress(){
		super();
	}
	
	/**
	 * Constructor with params
	 * @param smsAddress user entered SMS address
	 */
	public SMSAddress(String smsAddress){
		super(smsAddress);
		address = address.replaceAll(" ", "");
		address = address.trim();
	}

	/************************************************************************************/
	/* START Validation
	/*----------------------------------------------------------------------------------*/
	@Override
	public List<Status> validate() {
		super.validate();
		if(!address.matches("[\\d]*")){
			statusList.add(new AddressFormatError(address));
		}
		return statusList;
	}
	/*----------------------------------------------------------------------------------*/
	/* END Validation
	/************************************************************************************/


}
